/*项目信用评分-详情*/
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:frametrim/appviews/lineToTextView.dart';
import 'package:frametrim/utility/screen.dart';
import 'package:frametrim/views/appbar_black.dart';
import 'package:frametrim/views/background_view.dart';
import 'package:get/get.dart';

import '../../appviews/textUpTextView.dart';
import '../../utility/sq_color.dart';
import '../../views/lineargradient_view.dart';

class ProjectCreditPointDetailsPage extends StatefulWidget {
  @override
  State<StatefulWidget> createState() => ProjectCreditPointDetailsState();

}

class ProjectCreditPointDetailsState
    extends State<ProjectCreditPointDetailsPage> {
  late String name='';
  @override
  Widget build(BuildContext context) {
    name = Get.arguments;
    return Scaffold(
      backgroundColor: SQColor.color_background,
      body: AnnotatedRegion(
        value: SystemUiOverlayStyle.light,
        child: Stack(
          children: [
            //渐变背景
            Container(
              width: Screen.width,
              height: 230 + 45 + 10 + Screen.topSafeHeight + 50 + 55,
              decoration: BoxDecoration(
                gradient: LinearGradient(
                  //渐变色
                    colors: getColors(),
                    //渐变位置
                    begin: Alignment.topCenter,
                    end: Alignment.bottomCenter),
              ),
            ),
            Expanded(child:
            ListView(
              padding: EdgeInsets.only(top: 0),
              children: [buildTop1(), buildTop2(), buildMess()],
            )),
            AppbarCenterTitle(
              title: '项目信用评分',
              imgStr: 'image/imv_back_white.png',
              titleColor: SQColor.white,
            ),
          ],
        ),)
      ,
    );
  }

  /*信用等级布局*/
  Widget buildTop1() {
    return Container(
      margin: EdgeInsets.only(top: 45 + Screen.topSafeHeight + 10),
      width: 230,
      height: 230,
      decoration: BoxDecoration(
          image: DecorationImage(image: AssetImage('image/score_circle.png'))),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.center,
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          Text('116.00',
              style: TextStyle(
                  fontSize: 30,
                  color: SQColor.white,
                  fontWeight: FontWeight.bold)),
          Text('信用等级：良好', style: TextStyle(fontSize: 14, color: SQColor.white))
        ],
      ),
    );
  }

  /*分数*/
  Widget buildTop2() {
    return Container(
      margin: EdgeInsets.only(left: 32, right: 32, bottom: 10),
      height: 50,
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: [
          Column(
            crossAxisAlignment: CrossAxisAlignment.center,
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              Text('+2', style: TextStyle(fontSize: 16, color: SQColor.white)),
              SizedBox(height: 8),
              Text('拟加分数',
                  style: TextStyle(fontSize: 14, color: SQColor.white)),
            ],
          ),
          Column(
            crossAxisAlignment: CrossAxisAlignment.center,
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              Text('-2', style: TextStyle(fontSize: 16, color: SQColor.white)),
              SizedBox(height: 8),
              Text('拟扣分数',
                  style: TextStyle(fontSize: 14, color: SQColor.white)),
            ],
          ),
          Column(
            crossAxisAlignment: CrossAxisAlignment.center,
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              Text('+2', style: TextStyle(fontSize: 16, color: SQColor.white)),
              SizedBox(height: 8),
              Text('拟恢复分数',
                  style: TextStyle(fontSize: 14, color: SQColor.white)),
            ],
          ),
        ],
      ),
    );
  }

  /*项目信息*/
  Widget buildMess() {
    return Container(
    /*  margin: EdgeInsets.only(
          top: 230 + 45 + 10 + Screen.topSafeHeight + 50 + 10),*/
      child: BackgroundView(
        mVerticalPadding: 0,
          widget: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              SizedBox(height: 10),
              LineToTextView(
                  text1: "项目信息",
                  textSize: 14,
                  isBind: false,
                  paddingTop: 5,
                  textColor: SQColor.white),
              SizedBox(height: 15),
              Text('郑州市金水区陈砦城中村改造项目安置区B-04-01地块',
                  style: TextStyle(fontSize: 16, color: SQColor.color_3D3D3D)),
              SizedBox(height: 15),
              TextUpTextView('施工许可证号', '410141010018578'),
              TextUpTextView('项目类别', '房屋建筑施工工程'),
              TextUpTextView('项目区域', '郑州经济技术开发区'),
              TextUpTextView('建设单位', '河南飞鸿安全玻璃有限公司'),
              TextUpTextView('施工单位', '河南九九建筑工程有限公司'),
              TextUpTextView('监理单位', '河南民曜工程咨询有限公司'),
              TextUpTextView('监理单位', '河南民曜工程咨询有限公司'),
            ],
          )),
    );
  }
  /*根据状态判断不同渐变背景*/
List<Color> getColors(){
  List<Color> colors=[];
  if(name=="良好"){
    colors=[Color(0xFF3C86FF), Color(0xFF0052D9)];
  }else  if(name=="优秀"){
    colors=[Color(0xFF03C181), Color(0xFF018659)];
  }else  if(name=="警示"){
    colors=[Color(0xFFFFBD59), Color(0xFFDF9321)];
  }else  if(name=="失信"){
    colors=[Color(0xFFFF707B), Color(0xFFE34D59)];
  }

  return colors;
}
}
